home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / pcktgal.c < prev    next >
C/C++ Source or Header  |  2000-04-08  |  17KB  |  539 lines

  1. /***************************************************************************
  2.  
  3.     Pocket Gal                        (c) 1987 Data East Corporation
  4.     Pocket Gal (Bootleg)            (c) 1989 Yada East Corporation(!!!)
  5.     Super Pool III                    (c) 1989 Data East Corporation
  6.     Pocket Gal 2                    (c) 1989 Data East Corporation
  7.     Super Pool III (I-Vics Inc)        (c) 1990 Data East Corporation
  8.  
  9.     Pocket Gal (Bootleg) is often called 'Sexy Billiards'
  10.  
  11.     Emulation by Bryan McPhail, mish@tendril.co.uk
  12.  
  13. ***************************************************************************/
  14.  
  15. #include "driver.h"
  16. #include "vidhrdw/generic.h"
  17. #include "cpu/m6502/m6502.h"
  18.  
  19. /* From dec8.c - rename it to dec8_color prom later.. used by many games.. */
  20. void ghostb_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  21. void pcktgal_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  22. WRITE_HANDLER( pcktgal_flipscreen_w );
  23.  
  24. /***************************************************************************/
  25.  
  26. static WRITE_HANDLER( pcktgal_bank_w )
  27. {
  28.     unsigned char *RAM = memory_region(REGION_CPU1);
  29.  
  30.     if (data & 1) { cpu_setbank(1,&RAM[0x4000]); }
  31.     else { cpu_setbank(1,&RAM[0x10000]); }
  32.  
  33.     if (data & 2) { cpu_setbank(2,&RAM[0x6000]); }
  34.     else { cpu_setbank(2,&RAM[0x12000]); }
  35. }
  36.  
  37. static WRITE_HANDLER( pcktgal_sound_bank_w )
  38. {
  39.     unsigned char *RAM = memory_region(REGION_CPU2);
  40.  
  41.     if (data & 4) { cpu_setbank(3,&RAM[0x14000]); }
  42.     else { cpu_setbank(3,&RAM[0x10000]); }
  43. }
  44.  
  45. static WRITE_HANDLER( pcktgal_sound_w )
  46. {
  47.     soundlatch_w(0,data);
  48.     cpu_cause_interrupt(1,M6502_INT_NMI);
  49. }
  50.  
  51. static int msm5205next;
  52.  
  53. static void pcktgal_adpcm_int(int data)
  54. {
  55.     static int toggle;
  56.  
  57.     MSM5205_data_w(0,msm5205next >> 4);
  58.     msm5205next<<=4;
  59.  
  60.     toggle = 1 - toggle;
  61.     if (toggle)
  62.         cpu_cause_interrupt(1,M6502_INT_IRQ);
  63. }
  64.  
  65. static WRITE_HANDLER( pcktgal_adpcm_data_w )
  66. {
  67.     msm5205next=data;
  68. }
  69.  
  70. static READ_HANDLER( pcktgal_adpcm_reset_r )
  71. {
  72.     MSM5205_reset_w(0,0);
  73.     return 0;
  74. }
  75.  
  76. /***************************************************************************/
  77.  
  78. static struct MemoryReadAddress readmem[] =
  79. {
  80.     { 0x0000, 0x07ff, MRA_RAM },
  81.     { 0x1800, 0x1800, input_port_0_r },
  82.     { 0x1a00, 0x1a00, input_port_1_r },
  83.     { 0x1c00, 0x1c00, input_port_2_r },
  84.     { 0x4000, 0x5fff, MRA_BANK1 },
  85.     { 0x6000, 0x7fff, MRA_BANK2 },
  86.     { 0x8000, 0xffff, MRA_ROM },
  87.     { -1 }  /* end of table */
  88. };
  89.  
  90. static struct MemoryWriteAddress writemem[] =
  91. {
  92.     { 0x0000, 0x07ff, MWA_RAM },
  93.     { 0x0800, 0x0fff, videoram_w, &videoram, &videoram_size },
  94.     { 0x1000, 0x11ff, MWA_RAM, &spriteram, &spriteram_size },
  95.     { 0x1801, 0x1801, pcktgal_flipscreen_w },
  96.     /* 1800 - 0x181f are unused BAC-06 registers, see vidhrdw/dec0.c */
  97.     { 0x1a00, 0x1a00, pcktgal_sound_w },
  98.     { 0x1c00, 0x1c00, pcktgal_bank_w },
  99.     { 0x4000, 0xffff, MWA_ROM },
  100.     { -1 }  /* end of table */
  101. };
  102.  
  103. /***************************************************************************/
  104.  
  105. static struct MemoryReadAddress sound_readmem[] =
  106. {
  107.     { 0x0000, 0x07ff, MRA_RAM },
  108.     { 0x3000, 0x3000, soundlatch_r },
  109.     { 0x3400, 0x3400, pcktgal_adpcm_reset_r },    /* ? not sure */
  110.     { 0x4000, 0x7fff, MRA_BANK3 },
  111.     { 0x8000, 0xffff, MRA_ROM },
  112.     { -1 }    /* end of table */
  113. };
  114.  
  115. static struct MemoryWriteAddress sound_writemem[] =
  116. {
  117.     { 0x0000, 0x07ff, MWA_RAM },
  118.     { 0x0800, 0x0800, YM2203_control_port_0_w },
  119.     { 0x0801, 0x0801, YM2203_write_port_0_w },
  120.     { 0x1000, 0x1000, YM3812_control_port_0_w },
  121.     { 0x1001, 0x1001, YM3812_write_port_0_w },
  122.     { 0x1800, 0x1800, pcktgal_adpcm_data_w },    /* ADPCM data for the MSM5205 chip */
  123.     { 0x2000, 0x2000, pcktgal_sound_bank_w },
  124.     { 0x4000, 0xffff, MWA_ROM },
  125.     { -1 }    /* end of table */
  126. };
  127.  
  128. /***************************************************************************/
  129.  
  130. INPUT_PORTS_START( pcktgal )
  131.     PORT_START
  132.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  133.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  134.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  135.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  136.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  137.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  138.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
  139.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
  140.  
  141.     PORT_START
  142.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  143.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  144.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  145.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  146.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
  147.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
  148.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  149.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  150.  
  151.     PORT_START    /* Dip switch */
  152.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
  153.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  154.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  155.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  156.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  157.      PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) )
  158.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  159.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  160.      PORT_DIPNAME( 0x08, 0x08, "Allow 2 Players Game" )
  161.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  162.     PORT_DIPSETTING(    0x08, DEF_STR( Yes ) )
  163.      PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) )
  164.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  165.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  166.      PORT_DIPNAME( 0x20, 0x20, "Time" )
  167.     PORT_DIPSETTING(    0x00, "100" )
  168.     PORT_DIPSETTING(    0x20, "120" )
  169.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Lives ) )
  170.     PORT_DIPSETTING(    0x00, "3" )
  171.     PORT_DIPSETTING(    0x40, "4" )
  172.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  173.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  174.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  175. INPUT_PORTS_END
  176.  
  177. /***************************************************************************/
  178.  
  179. static struct GfxLayout charlayout =
  180. {
  181.     8,8,    /* 8*8 characters */
  182.     4096,
  183.     4,
  184.     { 0x10000*8, 0, 0x18000*8, 0x8000*8 },
  185.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  186.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  187.     8*8     /* every char takes 8 consecutive bytes */
  188. };
  189.  
  190. static struct GfxLayout bootleg_charlayout =
  191. {
  192.     8,8,    /* 8*8 characters */
  193.     4096,
  194.     4,
  195.     { 0x18000*8, 0x8000*8, 0x10000*8, 0 },
  196.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  197.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  198.     8*8     /* every char takes 8 consecutive bytes */
  199. };
  200.  
  201. static struct GfxLayout spritelayout =
  202. {
  203.     16,16,  /* 16*16 sprites */
  204.     1024,   /* 1024 sprites */
  205.     2,      /* 2 bits per pixel */
  206.     { 0x8000*8, 0 },
  207.     { 128+0, 128+1, 128+2, 128+3, 128+4, 128+5, 128+6, 128+7, 0, 1, 2, 3, 4, 5, 6, 7 },
  208.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  209.     32*8    /* every char takes 8 consecutive bytes */
  210. };
  211.  
  212. static struct GfxLayout bootleg_spritelayout =
  213. {
  214.     16,16,  /* 16*16 sprites */
  215.     1024,   /* 1024 sprites */
  216.     2,      /* 2 bits per pixel */
  217.     { 0x8000*8, 0 },
  218.     { 128+7, 128+6, 128+5, 128+4, 128+3, 128+2, 128+1, 128+0, 7, 6, 5, 4, 3, 2, 1, 0,  },
  219.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  220.     32*8    /* every char takes 8 consecutive bytes */
  221. };
  222.  
  223. static struct GfxDecodeInfo gfxdecodeinfo[] =
  224. {
  225.     { REGION_GFX1, 0x00000, &charlayout,   256, 16 }, /* chars */
  226.     { REGION_GFX2, 0x00000, &spritelayout,   0,  8 }, /* sprites */
  227.     { -1 } /* end of array */
  228. };
  229.  
  230. static struct GfxDecodeInfo bootleg_gfxdecodeinfo[] =
  231. {
  232.     { REGION_GFX1, 0x00000, &bootleg_charlayout,   256, 16 }, /* chars */
  233.     { REGION_GFX2, 0x00000, &bootleg_spritelayout,   0,  8 }, /* sprites */
  234.     { -1 } /* end of array */
  235. };
  236.  
  237. /***************************************************************************/
  238.  
  239. static struct YM2203interface ym2203_interface =
  240. {
  241.     1,      /* 1 chip */
  242.     1500000,        /* 1.5 MHz */
  243.     { YM2203_VOL(60,60) },
  244.     { 0 },
  245.     { 0 },
  246.     { 0 },
  247.     { 0 }
  248. };
  249.  
  250. static struct YM3812interface ym3812_interface =
  251. {
  252.     1,            /* 1 chip (no more supported) */
  253.     3000000,    /* 3 MHz */
  254.     { 50 }
  255. };
  256.  
  257. static struct MSM5205interface msm5205_interface =
  258. {
  259.     1,                    /* 1 chip             */
  260.     384000,                /* 384KHz             */
  261.     { pcktgal_adpcm_int },/* interrupt function */
  262.     { MSM5205_S48_4B},    /* 8KHz               */
  263.     { 70 }
  264. };
  265.  
  266. /***************************************************************************/
  267.  
  268. static struct MachineDriver machine_driver_pcktgal =
  269. {
  270.     /* basic machine hardware */
  271.     {
  272.         {
  273.             CPU_M6502,
  274.             2000000,
  275.             readmem,writemem,0,0,
  276.             nmi_interrupt,1
  277.         },
  278.         {
  279.             CPU_M6502 | CPU_AUDIO_CPU,
  280.             1500000,
  281.             sound_readmem,sound_writemem,0,0,
  282.             ignore_interrupt,0
  283.                             /* IRQs are caused by the ADPCM chip */
  284.                             /* NMIs are caused by the main CPU */
  285.         }
  286.     },
  287.     60, DEFAULT_60HZ_VBLANK_DURATION,  /* frames per second, vblank duration */
  288.     1, /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  289.     0,
  290.  
  291.     /* video hardware */
  292.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  293.     gfxdecodeinfo,
  294.     512, 512,
  295.     ghostb_vh_convert_color_prom,
  296.  
  297.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,
  298.     0,
  299.     generic_vh_start,
  300.     generic_vh_stop,
  301.     pcktgal_vh_screenrefresh,
  302.  
  303.     /* sound hardware */
  304.     0,0,0,0,
  305.     {
  306.         {
  307.             SOUND_YM2203,
  308.             &ym2203_interface
  309.         },
  310.         {
  311.             SOUND_YM3812,
  312.             &ym3812_interface
  313.         },
  314.         {
  315.             SOUND_MSM5205,
  316.             &msm5205_interface
  317.         }
  318.     }
  319. };
  320.  
  321. static struct MachineDriver machine_driver_bootleg =
  322. {
  323.     /* basic machine hardware */
  324.     {
  325.         {
  326.             CPU_M6502,
  327.             2000000,
  328.             readmem,writemem,0,0,
  329.             nmi_interrupt,1
  330.         },
  331.         {
  332.             CPU_M6502 | CPU_AUDIO_CPU,
  333.             1500000,
  334.             sound_readmem,sound_writemem,0,0,
  335.             ignore_interrupt,0
  336.                             /* IRQs are caused by the ADPCM chip */
  337.                             /* NMIs are caused by the main CPU */
  338.         }
  339.     },
  340.     60, DEFAULT_60HZ_VBLANK_DURATION,  /* frames per second, vblank duration */
  341.     1, /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  342.     0,
  343.  
  344.     /* video hardware */
  345.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  346.     bootleg_gfxdecodeinfo,
  347.     512, 512,
  348.     ghostb_vh_convert_color_prom,
  349.  
  350.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,
  351.     0,
  352.     generic_vh_start,
  353.     generic_vh_stop,
  354.     pcktgal_vh_screenrefresh,
  355.  
  356.     /* sound hardware */
  357.     0,0,0,0,
  358.     {
  359.         {
  360.             SOUND_YM2203,
  361.             &ym2203_interface
  362.         },
  363.         {
  364.             SOUND_YM3812,
  365.             &ym3812_interface
  366.         },
  367.         {
  368.             SOUND_MSM5205,
  369.             &msm5205_interface
  370.         }
  371.     }
  372. };
  373.  
  374. /***************************************************************************/
  375.  
  376. ROM_START( pcktgal )
  377.     ROM_REGION( 0x14000, REGION_CPU1 )     /* 64k for code + 16k for banks */
  378.     ROM_LOAD( "eb04.rom",       0x10000, 0x4000, 0x8215d60d )
  379.     ROM_CONTINUE(               0x04000, 0xc000)
  380.     /* 4000-7fff is banked but code falls through from 7fff to 8000, so */
  381.     /* I have to load the bank directly at 4000. */
  382.  
  383.     ROM_REGION( 2*0x18000, REGION_CPU2 )     /* 96k for code + 96k for decrypted opcodes */
  384.     ROM_LOAD( "eb03.rom",       0x10000, 0x8000, 0xcb029b02 )
  385.     ROM_CONTINUE(               0x08000, 0x8000 )
  386.  
  387.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  388.     ROM_LOAD( "eb01.rom",       0x00000, 0x10000, 0x63542c3d )
  389.     ROM_LOAD( "eb02.rom",       0x10000, 0x10000, 0xa9dcd339 )
  390.  
  391.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  392.     ROM_LOAD( "eb00.rom",       0x00000, 0x10000, 0x6c1a14a8 )
  393.  
  394.     ROM_REGION( 0x0400, REGION_PROMS )
  395.     ROM_LOAD( "eb05.rom",     0x0000, 0x0200, 0x3b6198cb ) /* 82s147.084 */
  396.     ROM_LOAD( "eb06.rom",     0x0200, 0x0200, 0x1fbd4b59 ) /* 82s131.101 */
  397. ROM_END
  398.  
  399. ROM_START( pcktgalb )
  400.     ROM_REGION( 0x14000, REGION_CPU1 )     /* 64k for code + 16k for banks */
  401.     ROM_LOAD( "sexybill.001", 0x10000, 0x4000, 0x4acb3e84 )
  402.     ROM_CONTINUE(              0x04000, 0xc000)
  403.     /* 4000-7fff is banked but code falls through from 7fff to 8000, so */
  404.     /* I have to load the bank directly at 4000. */
  405.  
  406.     ROM_REGION( 2*0x18000, REGION_CPU2 )     /* 96k for code + 96k for decrypted opcodes */
  407.     ROM_LOAD( "eb03.rom",      0x10000, 0x8000, 0xcb029b02 )
  408.     ROM_CONTINUE(              0x08000, 0x8000 )
  409.  
  410.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  411.     ROM_LOAD( "sexybill.005", 0x00000, 0x10000, 0x3128dc7b )
  412.     ROM_LOAD( "sexybill.006", 0x10000, 0x10000, 0x0fc91eeb )
  413.  
  414.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  415.     ROM_LOAD( "sexybill.003", 0x00000, 0x08000, 0x58182daa )
  416.     ROM_LOAD( "sexybill.004", 0x08000, 0x08000, 0x33a67af6 )
  417.  
  418.     ROM_REGION( 0x0400, REGION_PROMS )
  419.     ROM_LOAD( "eb05.rom",     0x0000, 0x0200, 0x3b6198cb ) /* 82s147.084 */
  420.     ROM_LOAD( "eb06.rom",     0x0200, 0x0200, 0x1fbd4b59 ) /* 82s131.101 */
  421. ROM_END
  422.  
  423. ROM_START( pcktgal2 )
  424.     ROM_REGION( 0x14000, REGION_CPU1 )     /* 64k for code + 16k for banks */
  425.     ROM_LOAD( "eb04-2.rom",   0x10000, 0x4000, 0x0c7f2905 )
  426.     ROM_CONTINUE(              0x04000, 0xc000)
  427.     /* 4000-7fff is banked but code falls through from 7fff to 8000, so */
  428.     /* I have to load the bank directly at 4000. */
  429.  
  430.     ROM_REGION( 0x18000, REGION_CPU2 )     /* audio cpu */
  431.     ROM_LOAD( "eb03-2.rom",   0x10000, 0x8000, 0x9408ffb4 )
  432.     ROM_CONTINUE(              0x08000, 0x8000)
  433.  
  434.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  435.     ROM_LOAD( "eb01-2.rom",   0x00000, 0x10000, 0xe52b1f97 )
  436.     ROM_LOAD( "eb02-2.rom",   0x10000, 0x10000, 0xf30d965d )
  437.  
  438.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  439.     ROM_LOAD( "eb00.rom",      0x00000, 0x10000, 0x6c1a14a8 )
  440.  
  441.     ROM_REGION( 0x0400, REGION_PROMS )
  442.     ROM_LOAD( "eb05.rom",     0x0000, 0x0200, 0x3b6198cb ) /* 82s147.084 */
  443.     ROM_LOAD( "eb06.rom",     0x0200, 0x0200, 0x1fbd4b59 ) /* 82s131.101 */
  444. ROM_END
  445.  
  446. ROM_START( spool3 )
  447.     ROM_REGION( 0x14000, REGION_CPU1 )     /* 64k for code + 16k for banks */
  448.     ROM_LOAD( "eb04-2.rom",   0x10000, 0x4000, 0x0c7f2905 )
  449.     ROM_CONTINUE(              0x04000, 0xc000)
  450.     /* 4000-7fff is banked but code falls through from 7fff to 8000, so */
  451.     /* I have to load the bank directly at 4000. */
  452.  
  453.     ROM_REGION( 0x18000, REGION_CPU2 )     /* audio cpu */
  454.     ROM_LOAD( "eb03-2.rom",   0x10000, 0x8000, 0x9408ffb4 )
  455.     ROM_CONTINUE(              0x08000, 0x8000)
  456.  
  457.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  458.     ROM_LOAD( "deco2.bin",      0x00000, 0x10000, 0x0a23f0cf )
  459.     ROM_LOAD( "deco3.bin",      0x10000, 0x10000, 0x55ea7c45 )
  460.  
  461.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  462.     ROM_LOAD( "eb00.rom",      0x00000, 0x10000, 0x6c1a14a8 )
  463.  
  464.     ROM_REGION( 0x0400, REGION_PROMS )
  465.     ROM_LOAD( "eb05.rom",     0x0000, 0x0200, 0x3b6198cb ) /* 82s147.084 */
  466.     ROM_LOAD( "eb06.rom",     0x0200, 0x0200, 0x1fbd4b59 ) /* 82s131.101 */
  467. ROM_END
  468.  
  469. ROM_START( spool3i )
  470.     ROM_REGION( 0x14000, REGION_CPU1 )     /* 64k for code + 16k for banks */
  471.     ROM_LOAD( "de1.bin",      0x10000, 0x4000, 0xa59980fe )
  472.     ROM_CONTINUE(              0x04000, 0xc000)
  473.     /* 4000-7fff is banked but code falls through from 7fff to 8000, so */
  474.     /* I have to load the bank directly at 4000. */
  475.  
  476.     ROM_REGION( 0x18000, REGION_CPU2 )     /* audio cpu */
  477.     ROM_LOAD( "eb03-2.rom",   0x10000, 0x8000, 0x9408ffb4 )
  478.     ROM_CONTINUE(              0x08000, 0x8000)
  479.  
  480.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  481.     ROM_LOAD( "deco2.bin",      0x00000, 0x10000, 0x0a23f0cf )
  482.     ROM_LOAD( "deco3.bin",      0x10000, 0x10000, 0x55ea7c45 )
  483.  
  484.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  485.     ROM_LOAD( "eb00.rom",      0x00000, 0x10000, 0x6c1a14a8 )
  486.  
  487.     ROM_REGION( 0x0400, REGION_PROMS )
  488.     ROM_LOAD( "eb05.rom",     0x0000, 0x0200, 0x3b6198cb ) /* 82s147.084 */
  489.     ROM_LOAD( "eb06.rom",     0x0200, 0x0200, 0x1fbd4b59 ) /* 82s131.101 */
  490. ROM_END
  491.  
  492. /***************************************************************************/
  493.  
  494. static void init_deco222(void)
  495. {
  496.     int A;
  497.     unsigned char *rom = memory_region(REGION_CPU2);
  498.     int diff = memory_region_length(REGION_CPU2) / 2;
  499.  
  500.  
  501.     memory_set_opcode_base(1,rom+diff);
  502.  
  503.     /* bits 5 and 6 of the opcodes are swapped */
  504.     for (A = 0;A < diff;A++)
  505.         rom[A + diff] = (rom[A] & 0x9f) | ((rom[A] & 0x20) << 1) | ((rom[A] & 0x40) >> 1);
  506. }
  507.  
  508. static void init_graphics(void)
  509. {
  510.     unsigned char *rom = memory_region(REGION_GFX1);
  511.     int len = memory_region_length(REGION_GFX1);
  512.     int i,j,temp[16];
  513.  
  514.     /* Tile graphics roms have some swapped lines, original version only */
  515.     for (i = 0x00000;i < len;i += 32)
  516.     {
  517.         for (j=0; j<16; j++)
  518.         {
  519.             temp[j] = rom[i+j+16];
  520.             rom[i+j+16] = rom[i+j];
  521.             rom[i+j] = temp[j];
  522.         }
  523.     }
  524. }
  525.  
  526. static void init_pcktgal(void)
  527. {
  528.     init_deco222();
  529.     init_graphics();
  530. }
  531.  
  532. /***************************************************************************/
  533.  
  534. GAME( 1987, pcktgal,  0,       pcktgal, pcktgal, pcktgal,  ROT0, "Data East Corporation", "Pocket Gal (Japan)" )
  535. GAME( 1989, pcktgalb, pcktgal, bootleg, pcktgal, deco222,  ROT0, "bootleg", "Pocket Gal (bootleg)" )
  536. GAME( 1989, pcktgal2, pcktgal, pcktgal, pcktgal, graphics, ROT0, "Data East Corporation", "Pocket Gal 2 (World?)" )
  537. GAME( 1989, spool3,   pcktgal, pcktgal, pcktgal, graphics, ROT0, "Data East Corporation", "Super Pool III (World?)" )
  538. GAME( 1990, spool3i,  pcktgal, pcktgal, pcktgal, graphics, ROT0, "Data East Corporation (I-Vics license)", "Super Pool III (I-Vics)" )
  539.